package com.huwaiwai.web.controller;

import com.huwaiwai.activemq.demo02.producer.queue.ProducerService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jms.Destination;

/**
 * Created by huweiwei on 2017/4/28.
 */
@RestController
@RequestMapping("activemq")
public class ActivemqQueueTest {

    @Autowired
    private ProducerService producerService;
    @Autowired
    @Qualifier("queueDestination")
    private Destination destination;

    @GetMapping("queue")
    public void testSend() {
        for (int i = 0; i < 2; i++) {
            producerService.sendMessage(destination, "-------" + i);
        }
    }

}
